﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace WEALTH.Manager.Customer
{
    public partial class ShowIndexImage : System.Web.UI.Page
    {
        ExcuteDao dao = new ExcuteDao();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.Request.QueryString["Image_ID"]))
            {

                DataTable dt = dao.GET_IndexImage(Convert.ToInt32(this.Request.QueryString["Image_ID"]));
               if (dt != null && dt.Rows.Count > 0)
               {
                   try
                   {
                       Response.Buffer = true;
                       Response.Clear();
                       Response.ContentType = dt.Rows[0]["Image_ContentType"].ToString(); //读取文件类型
                       Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(dt.Rows[0]["Image_Name"].ToString()));
                       Response.BinaryWrite((byte[])dt.Rows[0]["Image_Text"]);
                       Response.Flush();
                       Response.End();
                   }
                   catch (Exception ex)
                   {
                       string strMsg = ex.Message.ToString();
                       AppFunction.SaveExceptionLog(ex);
                   }
               }

            }
            this.Dispose();
        }

      

    }
}